#ifndef __INDEX_BUFFER_GLES_H__
#define __INDEX_BUFFER_GLES_H__

#pragma once

#include "RendererGLESCompileConfig.h"
#include "IndexBuffer.h"

namespace Nezha
{

	class RendererGLES;

	class IndexBufferGLES : public IndexBuffer
	{
	public:
		/** we use shadow buffer always
		maybe use glMapBufferOES later.
		*/
		IndexBufferGLES(HardwareBuffer::Usage usage, IndexType it, u32 numIndices
			,RendererGLES* r, u16* data);
		~IndexBufferGLES();

		GLuint getBufferId() const
		{
			return mGLBufferId;
		}

NEZHA_INTERNAL:

		void* _internalAccess_FEOI()
		{
			return mShadowBuffer.data();
		}
	protected:
		// we use shadow buffer always
		virtual void* lockImpl(u32 offset, u32 length, LockOption opt);
		virtual void unlockImpl();
		virtual void syncShadowBuffer();
	private:
		GLuint mGLBufferId;
		RendererGLES* mRenderer;
	};

}//end namespace Nezha

#endif //end __INDEX_BUFFER_GLES_H__